""" 
End to end test for chessboard. 
I verify each step using my new MoveStore module
for getAllTextMoves and getLastMove. 
Peter Kelly, 11203901
"""

import unittest
import time
from ChessBoard import *
from MoveStore import *

class TestEndToEndPeter(unittest.TestCase):

    def testRunner(self):
        cb = ChessBoard()
        store = MoveStore(cb)
	moves = []

        with open('moves2.txt', 'r') as f:
	    for line in f:
    	        moves.extend((line.rstrip()).split(" "))

	for move in moves:
    	    cb.printBoard()
            cb.addTextMove(move)
            lastTextMove = store.getLastTextMove()
            self.assertEqual(lastTextMove, move)
            time.sleep(0.5)

	cb.printBoard()
        allMoves = store.getAllTextMoves()
        self.assertEqual(allMoves, moves)


if __name__ == "__main__":
    unittest.main()
